function viewSubmenu(){

  var id=event.srcElement.id;
  
  var idNum=id.substring(7)

 
  for(var i=0;i<maxL;i++){  	
    try{  
       document.all["menu"+navigatorItemContainer[i].id].style.display="none"; 
  	   document.all["substr"+navigatorItemContainer[i].id].style.display="none"; 
  	 }catch(e){}	
  	}
    
  	eval("td_menu"+idNum).height="26";
  	document.all["menu"+idNum].style.display=""; 
 
}
function viewFromHeadmenu(menuID){

  for(var i=0;i<maxL;i++){  	
    try{
  	   eval("td_menu"+parent.head.navigatorItemContainer[i].id).height="1";
  	   eval("menu"+parent.head.navigatorItemContainer[i].id).style.display="none";
  	 }catch(e){}	
  	}
  
  	eval("td_menu"+menuID).height="100%";
  	eval("menu"+menuID).style.display="";
    	
}
function tree(){
this.branches = new Array();
this.add = addBranch;
this.write = writeTree;
}

function addBranch(branch){
this.branches[this.branches.length] = branch;
}

function writeTree(){
var treeString = '<table height=430 border=0 align=left  width=195  CELLSPACING=0 CELLPADDING=0  bordercolor=#000000 bordercolordark=#ffffff ><tr height=100%><td height=100% valign=top align=center>';
treeString=treeString+'<DIV id="Layer1" style=" Z-INDEX: 1; LEFT: 5px; OVERFLOW-X: hidden; width:95%;height:400px">'
treeString=treeString+'<TABLE  border="0" cellPadding="0" cellSpacing="0"  width="100%">'
var numBranches = this.branches.length;
for (var i=0;i<numBranches;i++)
 treeString += this.branches[i].write();
treeString =treeString+'</table>';
treeString =treeString+'</div>';
treeString =treeString+'</td></tr></table>';

document.all.menuitem.innerHTML=treeString;
//document.write(treeString);
}


function branch(id,text){
this.id=id
this.text = text;
this.write = writeBranch;
this.add = addLeaf;
this.leaves = new Array();
}


function addLeaf(leaf){
this.leaves[this.leaves.length] = leaf;
}

function writeBranch(){
var branchString = '';
var numLeaves = this.leaves.length;

 
branchString=branchString+'<tr><td  height="26" colspan=2 align=center  style="cursor:hand" background="images/common/left-headbg.gif" id="'+this.id+'" name="'+this.id+'" onclick=viewSubmenu\(\)><img src="images/common/arrow2.gif" width="6" height="6"> '+this.text+'</td></tr>'
branchString += '<tr><td id="subtr'+this.id.substring(3,this.id.length)+'" name="subtr'+this.id.substring(3,this.id.length)+'" align=center colspan=2 valign=top  background="images/left_003.gif" height=1><div id="'+this.id.substring(3,this.id.length)+'" name="'+ this.id.substring(3,this.id.length)+'" style="HEIGHT: 200px;display:none;overflow-x:auto;overflow-y:auto" align=center><table align=center width=100% height=100% cellPadding="0" cellSpacing="0" border=0><tr><td align=center ><table align=center cellPadding="0" cellSpacing="0" border=0>';

for (var i=0;i<this.leaves.length;i++)
 branchString += this.leaves[i].write();
 
branchString=branchString+'</table></td></tr></table></div></td></tr>'

return branchString;
}



function leaf(text,id,picpath){
this.text = text;
//this.link = link;
this.picpath=picpath;
this.id=id;
this.name=id;
this.write = writeLeaf;
}


function writeLeaf(){
var tbstr= '<tr><td width=20%>&nbsp;</td><td  background="images/common/left2-m.gif" class="left2-padding" valign=top onclick=subClick("'+this.id+'") align=left><img src="images/icon/icon1.gif" width="24" height="24" align="absmiddle">';
tbstr+='<font style="cursor:hand;">'+this.text+'</font></td> <td width="5"><img src="images/common/left2-r.gif" width="5" height="31"></td></tr><tr><td>&nbsp;</td></tr>';
/*
tbstr+='<tr><td align=center>';
//tbstr+='<a href="'+this.link+'"><img src="'+this.picpath+'" border=1></a>';
tbstr+='<img  onclick=subClick("'+this.id+'") src="'+this.picpath+'" border=1 >';
tbstr=tbstr+'</td></tr>';
*/
return tbstr
}

function subClick(id){

  if(typeof(doItemClick)=="function")
			  window.execScript(doItemClick(id))
}
